home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / rcmd.z / rcmd
Encoding:
Text File  |  2002-10-03  |  5.7 KB  |  133 lines

  1.  
  2.  
  3.  
  4. RRRRCCCCMMMMDDDD((((3333NNNN))))                                                              RRRRCCCCMMMMDDDD((((3333NNNN))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      rcmd, rresvport, ruserok - routines for returning a stream to a remote
  10.      command
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      rrrrccccmmmmdddd((((cccchhhhaaaarrrr ********aaaahhhhoooosssstttt,,,, uuuu____sssshhhhoooorrrrtttt iiiinnnnppppoooorrrrtttt,,,, cccchhhhaaaarrrr ****llllooooccccuuuusssseeeerrrr,,,, cccchhhhaaaarrrr ****rrrreeeemmmmuuuusssseeeerrrr,,,,
  14.                cccchhhhaaaarrrr ****ccccmmmmdddd,,,, iiiinnnntttt ****ffffdddd2222pppp))));;;;
  15.  
  16.      rrrrrrrreeeessssvvvvppppoooorrrrtttt((((iiiinnnntttt ****ppppoooorrrrtttt))));;;;
  17.  
  18.      rrrruuuusssseeeerrrrooookkkk((((cccchhhhaaaarrrr ****rrrrhhhhoooosssstttt,,,, iiiinnnntttt ssssuuuuppppeeeerrrruuuusssseeeerrrr,,,, cccchhhhaaaarrrr ****rrrruuuusssseeeerrrr,,,, cccchhhhaaaarrrr ****lllluuuusssseeeerrrr))));;;;
  19.  
  20. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.      _R_c_m_d is a routine used by the super-user to execute a command on a remote
  22.      machine using an authentication scheme based on reserved port numbers.
  23.      _R_r_e_s_v_p_o_r_t is a routine which returns a descriptor to a socket with an
  24.      address in the privileged port space.  _R_u_s_e_r_o_k is a routine used by
  25.      servers to authenticate clients requesting service with _r_c_m_d.  All three
  26.      functions are present in the same file and are used by the _r_s_h_d(1M)
  27.      server (among others).
  28.  
  29.      _R_c_m_d looks up the host *_a_h_o_s_t using _g_e_t_h_o_s_t_b_y_n_a_m_e(3N), returning -1 if
  30.      the host does not exist.  Otherwise *_a_h_o_s_t is set to the standard name of
  31.      the host and a connection is established to a server residing at the
  32.      well-known Internet port _i_n_p_o_r_t.
  33.  
  34.      If the connection succeeds, a socket in the Internet domain of type
  35.      SOCK_STREAM is returned to the caller, and given to the remote command as
  36.      ssssttttddddiiiinnnn and ssssttttddddoooouuuutttt.  If _f_d_2_p is non-zero, then an auxiliary channel to a
  37.      control process will be set up, and a descriptor for it will be placed in
  38.      *_f_d_2_p.  The control process will return diagnostic output from the
  39.      command (unit 2) on this channel, and will also accept bytes on this
  40.      channel as being UNIX signal numbers, to be forwarded to the process
  41.      group of the command.  If _f_d_2_p is 0, then the ssssttttddddeeeerrrrrrrr (unit 2 of the
  42.      remote command) will be made the same as the ssssttttddddoooouuuutttt and no provision is
  43.      made for sending arbitrary signals to the remote process, although you
  44.      may be able to get its attention by using out-of-band data.
  45.  
  46.      The protocol is described in detail in _r_s_h_d(1M).
  47.  
  48.      The _r_r_e_s_v_p_o_r_t routine is used to obtain a socket with a privileged
  49.      address bound to it.  This socket is suitable for use by _r_c_m_d and several
  50.      other routines.  Privileged Internet ports are those in the range 512 to
  51.      1023.  Only the super-user is allowed to bind an address of this sort to
  52.      a socket.
  53.  
  54.      _R_u_s_e_r_o_k takes a remote host's name, as returned by a _g_e_t_h_o_s_t_b_y_a_d_d_r(3N)
  55.      routine, two user names and a flag indicating whether the local user's
  56.      name is that of the super-user.  It then checks the files
  57.      /_e_t_c/_h_o_s_t_s._e_q_u_i_v and, possibly, ._r_h_o_s_t_s in the local user's home
  58.      directory to see if the request for service is allowed.  A 0 is returned
  59.      if the machine name is listed in the ``hosts.equiv'' file, or the host
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRCCCCMMMMDDDD((((3333NNNN))))                                                              RRRRCCCCMMMMDDDD((((3333NNNN))))
  71.  
  72.  
  73.  
  74.      and remote user name are found in the ``.rhosts'' file; otherwise _r_u_s_e_r_o_k
  75.      returns -1.  If the _s_u_p_e_r_u_s_e_r flag is 1, the checking of the
  76.      ``hosts.equiv'' file is bypassed.  If the local domain (as obtained from
  77.      _g_e_t_h_o_s_t_n_a_m_e(2)) is the same as the remote domain, only the machine name
  78.      need be specified.
  79.  
  80. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  81.      rlogin(1C), rsh(1C), intro(2), rexec(3N), rexecd(1M), rlogind(1M),
  82.      rshd(1M)
  83.  
  84. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  85.      _R_c_m_d returns a valid socket descriptor on success.  It returns -1 on
  86.      error and prints a diagnostic message on the standard error.
  87.  
  88.      _R_r_e_s_v_p_o_r_t returns a valid, bound socket descriptor on success.  It
  89.      returns -1 on error with the global value _e_r_r_n_o set according to the
  90.      reason for failure.  The error code EAGAIN is overloaded to mean ``All
  91.      network ports in use.''
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.